<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .parent {
      width: 200px;
      height: 200px;
      background-color: lemonchiffon;
      /* 1.利用伸缩盒 */
      display: flex;
      /* 1.2/2.2设置主轴居中 */
      /* justify-content: center; */
      /* 1.3/2.3设置交叉轴 */
      align-items: center;

      /* 2.宫格 */
      /* display: grid; */



    }

    .child {
      width: 100px;
      height: 100px;
      background-color: lightblue;
      /* 3.父：flex+子：margin：auto */
      margin: auto;
    }
  </style>
</head>

<body>

</body>
<div class="parent">
  <div class="child"></div>
</div>

</html>